package com.speedy.course.utils

import android.app.Activity
import android.view.View
import androidx.annotation.ColorRes
import com.gyf.immersionbar.ImmersionBar
import com.speedy.course.R

object StatusBarUtils {

    /**
     * 设置状态栏背景色
     */
    fun setStatusBarBackground(activity: Activity, @ColorRes statusBarColor: Int = R.color.white, isDarkFont:Boolean = true) {
        ImmersionBar.with(activity)
            .autoStatusBarDarkModeEnable(true, 0.2f)
            .statusBarDarkFont(isDarkFont, 0.2f)
            .navigationBarColor(R.color.white)
            .statusBarColor(statusBarColor)
            .fitsSystemWindows(true)
            .init()
    }


    fun setStatusBarTransparent(activity: Activity,isDarkFont:Boolean = true) {
        ImmersionBar.with(activity)
            .autoStatusBarDarkModeEnable(true, 0.2f)
            .autoNavigationBarDarkModeEnable(true, 0.2f)
            .statusBarDarkFont(isDarkFont)
            .navigationBarColor(R.color.white)
            .statusBarColor(android.R.color.transparent)
            .fitsSystemWindows(false)
            .init()
    }

    fun setStatusBarView(activity: Activity, view: View) {
        ImmersionBar.setStatusBarView(activity, view)
    }
}